export default function define(Blocks: Blockly.BlockDefinitions) {
  Blocks['importaispeech'] = {
    init: function () {
      this.appendDummyInput()
        .appendField('导入百度人工智能库');
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
      this.setColour("#E4E436");
      this.setTooltip('导入引脚库');
      this.setHelpUrl('http://gpiozero.readthedocs.io');
    },
  };
  
  Blocks['api_speech'] = {
    init: function () {
      this.appendDummyInput()
        .appendField('语音帐号：API_ID');
      this.appendValueInput("api_id")
        .setCheck(null);
      this.appendDummyInput()
        .appendField('API_KEY');
      this.appendValueInput("api_key")
        .setCheck(null);
      this.appendDummyInput()
        .appendField('SECRET_KEY');
      this.appendValueInput("secret_key")
        .setCheck(null);  
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
      this.setColour("#E4E436");
      this.setTooltip('');
      
    },
    };
    
    Blocks['api_image'] = {
    init: function () {
      this.appendDummyInput()
        .appendField('图像帐号：API_ID');
      this.appendValueInput("api_id")
        .setCheck(null);
      this.appendDummyInput()
        .appendField('API_KEY');
      this.appendValueInput("api_key")
        .setCheck(null);
      this.appendDummyInput()
        .appendField('SECRET_KEY');
      this.appendValueInput("secret_key")
        .setCheck(null);  
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
      this.setColour("#E4E436");
      this.setTooltip('');
      
    },
    };
    
    Blocks['api_ocr'] = {
    init: function () {
      this.appendDummyInput()
        .appendField('文字识别帐号：API_ID');
      this.appendValueInput("api_id")
        .setCheck(null);
      this.appendDummyInput()
        .appendField('API_KEY');
      this.appendValueInput("api_key")
        .setCheck(null);
      this.appendDummyInput()
        .appendField('SECRET_KEY');
      this.appendValueInput("secret_key")
        .setCheck(null);  
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
      this.setColour("#E4E436");
      this.setTooltip('');
      
    },
    };

    Blocks['api_face'] = {
    init: function () {
      this.appendDummyInput()
        .appendField('人脸识别帐号：API_ID');
      this.appendValueInput("api_id")
        .setCheck(null);
      this.appendDummyInput()
        .appendField('API_KEY');
      this.appendValueInput("api_key")
        .setCheck(null);
      this.appendDummyInput()
        .appendField('SECRET_KEY');
      this.appendValueInput("secret_key")
        .setCheck(null);  
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
      this.setColour("#E4E436");
      this.setTooltip('');
      
    },
    };

    Blocks['api_default_speech'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("使用默认语音账号");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour(230);
            this.setTooltip("");
            this.setHelpUrl("");
            this.setColour("#E4E436");
        },
    };
    
    Blocks['api_default_image'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("使用默认图像账号");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour(230);
            this.setTooltip("");
            this.setHelpUrl("");
            this.setColour("#E4E436");
        },
    };

    Blocks['api_default_ocr'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("使用默认文字识别账号");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour(230);
            this.setTooltip("");
            this.setHelpUrl("");
            this.setColour("#E4E436");
        },
    };
    
    Blocks['api_default_face'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("使用默认人脸识别账号");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour(230);
            this.setTooltip("");
            this.setHelpUrl("");
            this.setColour("#E4E436");
        },
    };
  
  Blocks['synthesis'] = {
    init: function () {
        this.appendDummyInput()
            .appendField("合成语音");
        this.appendValueInput("text")
            .setCheck(null);
        this.appendDummyInput()
            .appendField("的结果存放在")
            .appendField(new Blockly.FieldVariable("audio"), "path");
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
      this.setColour("#16AEE5");
    },
  };
  
  Blocks['Tuling'] = {
    init: function () {
        this.appendDummyInput()
            .appendField("智能语音对话");
        this.appendValueInput("text")
            .setCheck(null);
        this.appendDummyInput()
            .appendField("对话存放在")
            .appendField(new Blockly.FieldVariable("answer"), "answer");
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
      this.setColour("#16AEE5");
    },
  };
  
     Blocks['wakeup_default'] = {
        init: function () {
            this.appendDummyInput()
            	.appendField("小白语音唤醒关键词，执行detected函数，设置灵敏度")
            this.appendValueInput("value")
                .setCheck(null);
	    this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
     	    this.setColour("#16AEE5");     
        },
    };

    Blocks['synthesis1'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("合成语音");
            this.appendValueInput("text")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("的结果存放在")
                .appendField(new Blockly.FieldVariable("audio"), "path");
            this.appendDummyInput()
                .appendField("发音人")
                .appendField(new Blockly.FieldDropdown([['度丫丫', '4'], ['度逍遥', '3']]), 'per');
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#16AEE5");
        },
    };
    Blocks['audio_get'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("录制音频");
            this.appendDummyInput()
                .appendField("时间");
           this.appendValueInput("time")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("秒");
            this.appendDummyInput()
                .appendField("，结果存放在")
                .appendField(new Blockly.FieldVariable("result"), "result");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#16AEE5");
        },
    };
    
    Blocks['audio_play'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("播放录音");
            this.appendValueInput("text")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("时间");
           this.appendValueInput("time")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("秒");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#16AEE5");
        },
    };
    
        Blocks['audio_play_mp3'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("播放合成语音");
            this.appendValueInput("text")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("时间");
           this.appendValueInput("time")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("秒");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#16AEE5");
        },
    };
    
    Blocks['audio_play_mp3_default'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("播放合成语音");
            this.appendValueInput("text")
                .setCheck(null);
            
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#16AEE5");
        },
    };
    
    
    
    Blocks['audio_recog'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("识别语音")
            	.appendField(new Blockly.FieldVariable("voice"), "voice");
            this.appendDummyInput()
                .appendField("结果存放在")
           	.appendField(new Blockly.FieldVariable("voice_result"), "voice_result");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#16AEE5");
        },
    };
    
    Blocks['audio_recog_bool'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("语音识别")
                .appendField(new Blockly.FieldVariable("path"), "path");
            this.appendDummyInput()
                .appendField("是否成功")
            this.setInputsInline(true);
            this.setOutput(true, null);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setColour("#16AEE5");
        },
    };
    
    Blocks['audio_recog_result'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("语音识别")
                .appendField(new Blockly.FieldVariable("path"), "path");
            this.appendDummyInput()
                .appendField("的结果")
            this.setInputsInline(true);
            this.setOutput(true, null);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setColour("#16AEE5");
        },
    };
    
    Blocks['image_get'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("使用树莓派拍摄图片，存放在")
                .appendField(new Blockly.FieldVariable("img"), "img");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#E51616");
        },
    };
    
    
    Blocks['image_recog'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("通用图像识别");
            this.appendValueInput("path")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("的结果存放在")
                .appendField(new Blockly.FieldVariable("img_result"), "img_result");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#E51616");
        },
    };
    
    Blocks['face_recog'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("人脸识别");
            this.appendValueInput("path")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("的结果存放在")
                .appendField(new Blockly.FieldVariable("face_result"), "face_result");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#E51616");
        },
    };
    
    Blocks['face_recog_result'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("人脸识别")
                .appendField(new Blockly.FieldVariable("result"), "result");
            this.appendDummyInput()
                .appendField("的")
                .appendField(new Blockly.FieldDropdown([['年龄', 'age'], ['颜值', 'beauty'], ['表情', 'expression'], ['性别', 'gender'], ['眼镜', 'glasses']]), 'action');
            this.setInputsInline(true);
            this.setOutput(true, null);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setColour("#E51616");
        },
    };
    
    
    Blocks['plate_recog'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("车牌识别");
            this.appendValueInput("path")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("的结果存放在")
                .appendField(new Blockly.FieldVariable("plate_result"), "plate_result");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#E51616");
        },
    };
    
    Blocks['words_recog'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("文字识别");
            this.appendValueInput("path")
                .setCheck(null);
            this.appendDummyInput()
                .appendField("的结果存放在")
                .appendField(new Blockly.FieldVariable("words_result"), "words_result");
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setColour("#E51616");
        },
    };
    
     Blocks['image_recog_root'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("通用图像识别")
                .appendField(new Blockly.FieldVariable("result"), "result");
            this.appendDummyInput()
                .appendField("的种类")
            this.setInputsInline(true);
            this.setOutput(true, null);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setColour("#E51616");
        },
    };
    
     Blocks['image_recog_keyword'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("通用图像识别")
                .appendField(new Blockly.FieldVariable("result"), "result");
            this.appendDummyInput()
                .appendField("的结果")
            this.setInputsInline(true);
            this.setOutput(true, null);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setColour("#E51616");
        },
    };
    
    Blocks['plate_recog_keyword'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("车牌识别")
                .appendField(new Blockly.FieldVariable("result"), "result");
            this.appendDummyInput()
                .appendField("的结果")
            this.setInputsInline(true);
            this.setOutput(true, null);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setColour("#E51616");
        },
    };
    
    Blocks['words_recog_keyword'] = {
        init: function () {
            this.appendDummyInput()
                .appendField("文字识别")
                .appendField(new Blockly.FieldVariable("result"), "result");
            this.appendDummyInput()
                .appendField("的结果")
            this.setInputsInline(true);
            this.setOutput(true, null);
            this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
            this.setColour("#E51616");
        },
    };
    
    Blocks['define1'] = {
    init: function () {
      this.appendDummyInput()
        .appendField('定义 detected 函数执行:');
      this.appendStatementInput('DO')
        .setCheck(null);
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
      this.setTooltip('');
      this.setHelpUrl('http://www.example.com/');
      this.setColour("#16AEE5");
    },
  };
  
 
}
